package com.springsummer.information.green.hello;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class HelloOneService implements InitializingBean, DisposableBean {

    private String name;

    private String helloName;

    public HelloOneService() {
    }

    public HelloOneService(String name, String helloName) {
        this.name = name;
        this.helloName = helloName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHelloName() {
        return helloName;
    }

    public void setHelloName(String helloName) {
        this.helloName = helloName;
    }

    public String sayHello(){
        String str="hello "+name;
        System.out.println(str);
        return str;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        //初始化方法调用
        System.out.println("InitializingBean");
    }
}
